import request from '@/utils/http'

// 通过userId获取实体店信息
export function getWholesalerInfoAPI(userId) {
  return request({
    url: '/wholesaler/selectWholesalerByUserId',
    method: 'get',
    params: { userId }
  })
}

// 更新批发商信息
export function updateWholesalerInfoAPI(data) {
  return request({
    url: '/wholesaler/updatewholesaler',
    method: 'put',
    data: data,
    headers: {
      "Content-Type": "multipart/form-data"
    }
  })
}

//更新商户登录信息
export function updateUserApi(params) {
  return request({
    url: '/user/updateUser',
    method: 'put',
    params: params,
  })
}

// 获取地址列表
export function getAddressListAPI(id) {
  console.log(id);

  return request({
    url: '/address/findByUserId',
    method: 'get',
    params: { id }
  })
}

// 新增地址
export function addAddressAPI(data) {
  return request({
    url: '/address',
    method: 'post',
    data: data
  })
}

// 修改地址
export function updateAddressAPI(data) {
  return request({
    url: '/address',
    method: 'put',
    data: data
  })
}

// 删除地址
export function deleteAddressAPI(id) {
  return request({
    url: '/address/deleteAddress',
    method: 'delete',
    params: { id }
  })
}